﻿<!DOCTYPE html>
<?php
	include 'functions.php'; 	
	inclHeader();
        requestHTTPS();
	if (isset($_GET["call"])){
		if ($_GET["call"] == "cookie"){
			define( "ONE_HOUR", 60 * 60 ); // define constant
			// write each form field’s value to a cookie and set the 
			// cookie’s expiration date
			setcookie( "userName", $_SESSION['uporabnikUname'], time() + ONE_HOUR );    
			setcookie( "password", $_SESSION['uporabnikPass'], time() + ONE_HOUR );
			header("Location: ./index.php");
		}
	}

?>
<html>
  <head> 
	<link rel = "stylesheet"  type = "text/css" href = "CSS.css" />
	<meta charset = "utf-8">
  	<title> Podutik Records </title>
  	<style type="text/css"></style>
	<script src="jquery.js"></script>
	<script src="myQuery.js"></script>
  </head>
  <body>
	<div id="page-container">

		<div id="main-nav">	
			<div class="block" id="bl1" style="background-color: #EEEEEE;">
				
			</div>			
		</div>
			
		<div id="header">		
			<a href="./index.php"><img id="logo1" src="podutikrecords1.jpg" 
			width="236" height="36" alt="Enlighten Designs" /></a>	
		</div>
		
		<div id="prijava">
			<h2 id="clogin">Customer Login</h2>
			<div class="obrazec">
				<div style="width: 650px;">
				<form name ="prijava" id="registracija" method="post" action="#">
					<h3>
                                            <label id="uname">Username: </label>
                                            <input type="text" name="loginUsername" class="reginp" id="loguname" class="inputlog" size="30" 
                                                   value="<?php 
                                                   if(isset($_POST['loginUsername'])) {      
                                                       echo $_POST['loginUsername'];
                                                   } 
                                                   else if (isset($_COOKIE["userName"])) {
                                                       echo $_COOKIE["userName"];
                                                   }?>"/>
                                        </h3>
                                        <h5 id="logunameerr" style="visibility: hidden;">*Wrong username</h5>
					<br/>
					<h3>
                                            <label id="pass">Password: </label>
                                            <input type="password" name="loginPassword" class="reginp" id="logpass" class="inputlog" size="30" 
                                                   value="<?php 
                                                   if(isset($_POST['loginPassword'])){ 
                                                       echo "";
                                                   }
                                                   else if (isset($_COOKIE["userName"])) {
                                                       echo $_COOKIE["userName"];
                                                   }?>"/>
                                        </h3>
                                        <h5 id ="logpasserr" style="visibility: hidden;">*Wrong password</h5>
					<!--<input type = "submit" value = "Submit">-->
					<br/>
					<h1><input type="image" id="log" src="loginpic.jpg" alt="prijava"/></h1>
				</form>
				</div>
			</div>	
		</div>
		<?php
                    footer();
                ?>
	
	</div>
    
	<?php
		login();
	?>
	
  </body>
  <script src="logforms.js"></script>
  
</html>